import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: jingziyou
 * Date: 2023-03-02
 * Time: 19:04
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] arr = new int[n][n];
        int i = 1;
        int row = 0, col = 0;
        int s1 = n, s2 = n, s3 = 0, s4 = 1;
        while (i <= n * n) {
            while (col < s1) {
                arr[row][col] = i;
                i++;
                col++;
            }
            col--;
            s1--;
            row++;
            while (row < s2) {
                arr[row][col] = i;
                i++;
                row++;
            }
            row--;
            s2--;
            col--;
            while (col >= s3) {
                arr[row][col] = i;
                i++;
                col--;
            }
            col++;
            s3++;
            row--;
            while (row >= s4) {
                arr[row][col] = i;
                i++;
                row--;
            }
            row++;
            s4++;
            col++;
        }
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                System.out.printf("%3d",arr[j][k]);
            }
            System.out.println();
        }
    }
}
